@extends('layout.default')

@section('layout.content')

  <div class="row">
    <div class="col-xs-12">
      <form method="get" class="form-horizontal">        
        <div class="col-xs-12 col-md-6">
          <div class="form-group">
            <div class="input-group">
              <input type="text" class="form-control input-lgr" id="query" name="query" maxlength="13" placeholder="ISBN"
                     autocomplete="off"/>
              <span class="input-group-btn">
                <button class="btn btn-lg btn-primary" id="btn-sign" type="submit"f>
                  <i class="ace-icon fa fa-search"></i>
                  借阅查询
                </button>
              </span>
            </div>
          </div>
        </div>
      </form>
    </div>
  </div><!-- /.row -->

  <div class="row">
    <div class="col-xs-12">
      <table id="borrow-list" class="table table-hover table-bordered table-striped nonborder">
      <thead>
      <tr>
        <th class="center hidden-480" style="width:60px;">帐号</th>
        <th class="align-middle" style="width:90px;">姓名</th>
        <th style="width:60px;" class="center">封面</th>
        <th style="width:130px;" class="center hidden-480">ISBN</th>
        <th class="align-left align-middle">书名</th>
        <th class="center hidden-480" style="width:100px;">借阅日期</th>
        <th style="width:70px;" class="center hidden-480">书架号</th>
        <th style="width:60px;" class="center hidden-480">状态</th>
        <th class="center" style="width:70px;">操作</th>
      </tr>
      </thead>

      <tbody>
      @foreach ($borrows as $borrow)
        <tr>
          <td class="center smaller-80"><a
                href="{{route('user.edit',array('uid'=>$borrow->user->id) )}}">{{ $borrow->user->account }}</a>
          </td>
          <td class="align-middle">{!! $borrow->user->present()->face !!}<a
                href="{{route('user.view',array('uid'=>$borrow->user->id))}}" class="uid"
                data-id="{{ $borrow->user->id }}">{{ $borrow->user->name }}</a></td>
          <td class="center"><a href="{{ route('book.edit',array('id'=>$borrow->book->id) ) }}"><img class="lazy book-img img-error1" src="/assets/images/blank.gif" data-original="/assets/images/books/{{$borrow->book->dbid}}.jpg" /></a></td>
          <td class="center smaller-80"><a
                href="{{route('book.borrows',array('id'=>$borrow->book->id) )}}">{{ $borrow->book->isbn }}</a></td>
          <td class="align-left align-middle">{{ $borrow->book->title }}</td>
          <td class="center grey smaller-80">{{date('Y-m-d',$borrow->date_begin)}}</td>
          <td class="center smaller-80">{!! $borrow->book->present()->bookStore !!}</td>
          <td class="center hidden-480">{!! $borrow->present()->BorrowStatus !!}</td>
          <td class="center">
            @if ($borrow->status == 0)
              <button class="btn btn-xs btn-green3 return" type="button" data-value="{{$borrow->id}}">
                还
              </button>
            @endif
          </td>
        </tr>
      @endforeach

      </tbody>
    </table>

    </div><!-- /.col -->
  </div><!-- /.row -->


  <div class="row">
    <div class="col-xs-12">
      <div class="dataTables_paginate paging_bootstrap">
        {{$borrows->links()}}
      </div>
    </div>
  </div>

@stop


@section('javascript')
  <script src="//cdn.bootcss.com/jquery_lazyload/1.9.7/jquery.lazyload.min.js"></script>
  <script src="/assets/js/user-func.js"></script>
  <script type="text/javascript">
      $(function () {
          $('#query').focus();

          $(".lazy").lazyload({
            effect : "fadeIn"
          });
      });
  </script>
@stop
